package com.jsftoolkit.gen.config;

import javax.faces.webapp.UIComponentELTag;
import javax.xml.xpath.XPathExpressionException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 * Interface for classes that can update JSP TLD files.
 * 
 * @author noah
 * 
 */
public interface TldEditor {
	/**
	 * Creates or updates and returns the appropriate tag element.
	 * 
	 * @param doc
	 *            the TLD document
	 * @param tagName
	 *            tag name
	 * @param tagClass
	 *            the class of the {@link UIComponentELTag} handler.
	 * @return the tag element
	 * @throws XPathExpressionException
	 */
	Element registerTag(Document doc, String tagName, String tagClass)
			throws XPathExpressionException;

	/**
	 * Creates or updates and returns the appropriate attribute element.
	 * 
	 * @param tag
	 *            the tag element
	 * @param name
	 *            the attribute name
	 * @param type
	 *            the class of the attribute; may be null.
	 * @param required
	 *            is the attribute required?
	 * @return the attribute element
	 * @throws XPathExpressionException
	 */
	Element registerAttribute(Element tag, String name, Class<?> type,
			boolean required) throws XPathExpressionException;
}
